<script setup>
defineProps({
  show: {
    type: Boolean,
    default: false
  }
})
</script>

<template>
  <div class="popup-background" :class="{ show: show }">
    <div class="popup-card" :class="{ show: show }">
      <slot></slot>
    </div>
  </div>
</template>

<style lang="scss" scoped>
@use '@/assets/scss/abstracts/variables' as *;
@use '@/assets/scss/abstracts/mixins' as *;

.popup {
  &-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba($color-black, 0.5);

    @include flexCenter;
    z-index: 1000;

    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;

    &.show {
      opacity: 1;
      visibility: visible;
    }
  }

  &-card {
    background-color: $color-white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 0.4rem 0.8rem rgba($color-black, 0.2);

    opacity: 0;
    visibility: hidden;
    transform: scale(0);
    transition: all 0.3s ease-in-out;

    &.show {
      opacity: 1;
      visibility: visible;
      transform: scale(1);
    }
  }
}
</style>
